package com.ebiz.plugin.alibc;

import android.app.Application;
import android.util.Log;

import io.dcloud.feature.uniapp.utils.UniLogUtils;

import com.alibaba.baichuan.android.trade.AlibcTradeSDK;
import com.alibaba.baichuan.android.trade.callback.AlibcTradeInitCallback;

import io.dcloud.feature.uniapp.UniAppHookProxy;

public class BCInit_AppProxy implements UniAppHookProxy {

    String TAG = "BCInit";

    static Application application;

    @Override
    public void onSubProcessCreate(Application application) {
//        this.bcInit(application);
    }

    @Override
    public void onCreate(Application application) {
        BCInit_AppProxy.application = application;

//        this.bcInit(application);
    }


    /**
     * 初始化
     * @param application
     */
    private void bcInit(Application application)
    {
        UniLogUtils.i("准备初始化");
        try {
            AlibcTradeSDK.asyncInit(application, new AlibcTradeInitCallback() {
                @Override
                public void onSuccess() {
                    UniLogUtils.i("初始化成功");
                }

                @Override
                public void onFailure(int code, String msg) {
                    UniLogUtils.i("初始化失败:" + msg);
                }
            });
        } catch (Throwable throwable) {
            Log.e(TAG, throwable.getMessage());
        }
    }
}
